package com.google.project.server.entity;

import java.io.Serializable;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.project.shared.DailyReportDetailDTO;

@SuppressWarnings("serial")
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class DailyReportDetail implements Serializable{
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;
	@Persistent
	private String reportId;
	@Persistent
	private String taskId;
	@Persistent
	private String taskName;
	@Persistent
	private Double workToFinished;
	@Persistent
	private String unit;
	@Persistent
	private String content;
	@Persistent
	private int status;
	@Persistent
	private Long createdOnDate;
	@Persistent
	private DailyReport dailyReport;
	@Persistent
	private String projectId;
	@Persistent
	private Long updateTime;
	@Persistent
	private String updateByUserId;
	public DailyReportDetail() {
	}

	public DailyReportDetail(DailyReportDetailDTO dailyReportDetailDTO) {
		this.taskId = dailyReportDetailDTO.getTaskId();
		this.taskName = dailyReportDetailDTO.getTaskName();
		this.workToFinished = dailyReportDetailDTO.getWorkToFinished();
		this.unit=dailyReportDetailDTO.getUnit();
		this.content = dailyReportDetailDTO.getContent();
		this.status = dailyReportDetailDTO.getStatus();
		this.createdOnDate = dailyReportDetailDTO.getCreatedOnDate();
		this.projectId = dailyReportDetailDTO.getProjectId();
		this.updateTime=dailyReportDetailDTO.getUpdateTime();
		this.updateByUserId=dailyReportDetailDTO.getUpdateByUserId();
	}

	public DailyReportDetailDTO toDTO() {
		DailyReportDetailDTO data = new DailyReportDetailDTO();
		data.setId(id);
		data.setTaskId(taskId);
		data.setTaskName(taskName);
		data.setWorkToFinished(workToFinished);
		data.setUnit(unit);
		data.setContent(content);
		data.setStatus(status);
		data.setCreatedOnDate(createdOnDate);
		data.setProjectId(this.projectId);
		data.setUpdateTime(updateTime);
		data.setUpdateByUserId(updateByUserId);
		return data;
	}
	public void updateFromDTO(DailyReportDetailDTO dailyReportDetailDTO) {
		this.taskId = dailyReportDetailDTO.getTaskId();
		this.taskName = dailyReportDetailDTO.getTaskName();
		this.workToFinished = dailyReportDetailDTO.getWorkToFinished();
		this.unit=dailyReportDetailDTO.getUnit();
		this.content = dailyReportDetailDTO.getContent();
		this.status = dailyReportDetailDTO.getStatus();
		this.createdOnDate = dailyReportDetailDTO.getCreatedOnDate();
		this.projectId = dailyReportDetailDTO.getProjectId();
		this.updateTime=dailyReportDetailDTO.getUpdateTime();
		this.updateByUserId=dailyReportDetailDTO.getUpdateByUserId();
	}

	public String getProjectId() {
		return projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getReportId() {
		return reportId;
	}
	public void setReportId(String reportId) {
		this.reportId = reportId;
	}
	public String getTaskId() {
		return taskId;
	}
	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}
	public String getTaskName() {
		return taskName;
	}
	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}
	public Double getWorkToFinished() {
		return workToFinished;
	}
	public void setWorkToFinished(Double workToFinished) {
		this.workToFinished = workToFinished;
	}

	
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Long getCreatedOnDate() {
		return createdOnDate;
	}
	public void setCreatedOnDate(Long createdOnDate) {
		this.createdOnDate = createdOnDate;
	}

	public DailyReport getDailyReport() {
		return dailyReport;
	}

	public void setDailyReport(DailyReport dailyReport) {
		this.dailyReport = dailyReport;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public Long getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Long updateTime) {
		this.updateTime = updateTime;
	}

	public String getUpdateByUserId() {
		return updateByUserId;
	}

	public void setUpdateByUserId(String updateByUserId) {
		this.updateByUserId = updateByUserId;
	}
	
}
